package com.zjq.hibernate.pojo;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Bankcard entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "bankcard", catalog = "bank")
public class Bankcard implements java.io.Serializable {

	// Fields

	private Integer cardid;
	private String cardpwd;
	private Float money;
	private Set<User> users = new HashSet<User>(0);

	// Constructors

	/** default constructor */
	public Bankcard() {
	}

	/** minimal constructor */
	public Bankcard(String cardpwd) {
		this.cardpwd = cardpwd;
	}

	/** full constructor */
	public Bankcard(String cardpwd, Float money, Set<User> users) {
		this.cardpwd = cardpwd;
		this.money = money;
		this.users = users;
	}

	// Property accessors
	@Id
	@GeneratedValue
	@Column(name = "cardid", unique = true, nullable = false)
	public Integer getCardid() {
		return this.cardid;
	}

	public void setCardid(Integer cardid) {
		this.cardid = cardid;
	}

	@Column(name = "cardpwd", nullable = false, length = 45)
	public String getCardpwd() {
		return this.cardpwd;
	}

	public void setCardpwd(String cardpwd) {
		this.cardpwd = cardpwd;
	}

	@Column(name = "money", precision = 12, scale = 0)
	public Float getMoney() {
		return this.money;
	}

	public void setMoney(Float money) {
		this.money = money;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "bankcard")
	public Set<User> getUsers() {
		return this.users;
	}

	public void setUsers(Set<User> users) {
		this.users = users;
	}

}